

if [ -e /dev/tcaicard0 ];then
        AICARD_NUM=`ls /dev/tcaicard* | wc -l`
else
        echo "No card !"
        exit 1
fi

PSY_AICARD_NUM_1=`expr $AICARD_NUM / 3`

if [[ $PSY_AICARD_NUM_1 < 4 ]];
then
        echo "unknown card!"
        echo "card num is $PSY_AICARD_NUM_1"
        echo "test FAILED"
        exit 1
fi

sh check_all_3core.sh

result=$(sh check_all_3core.sh | grep -c 'N/A')


length=$(expr length "$result")
echo "result is $result"

if [[ $result -ne 0 ]];
then
        echo -e "ALL CARD CHECK SN RESULT: \E[31m [FAILED] \E[0m"
        exit
else
        echo -e "ALL CARD CHECK SN RESULT: \E[32m [PASS] \E[0m"
fi


let PSY_AICARD_NUM=${PSY_AICARD_NUM_1}-1

for card_id in `seq 0 ${PSY_AICARD_NUM}`
do
    sh single_3core_card.sh $card_id &
done

wait

echo "app finished"

